﻿using Demo.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Demo.Config
{
    public class StudentConfig : IEntityTypeConfiguration<Student>
    {
        public void Configure(EntityTypeBuilder<Student> builder)
        {
            builder.ToTable("students");

            builder.HasMany<Teacher>(x=>x.Teachers)
                .WithMany(x=>x.Students)
                .UsingEntity(x=>x.ToTable("student_teacher"));

        }
    }
}
